<%@ include file="/common/taglibs.jsp"%>
<%@ taglib prefix="product" tagdir="/WEB-INF/tags/product"%>
<fmt:message key="product.sku.default" var="defaultSkuName"/>
<div class="top clearfix">
		<ul class="tab">
			<li class="curr"><span><fmt:message key="productSkuSelector.title"/></span></li>
		</ul>
		<b class="red">[<fmt:message key="productSkuSelector.title.tip"/>]</b>
		<%@include file="/common/pagingOnlyTop.jsp"%>
</div>
<div class="data"  style="">
	<display:table name="${productList}" cellspacing="0" cellpadding="0"uid="product" class="list_table"  export="false" requestURI="">
		<display:column  sortable="false" decorator="com.probiz.estore.core.decorator.TblColumnDecorator" titleKey="product.productName">
			${product.productName}
		</display:column>
		<display:column style="width:65%;" sortable="false"  decorator="com.probiz.estore.core.decorator.TblColumnDecorator" titleKey="product.productSkuInfo">
			<div>
				<c:choose>
					<c:when test = "${product.isSetMultiSkus == '1'}">
						<c:forEach items="${product.productSkus}" var="sku">
							<c:set var="minOrderQuantity" value="1"/>
							<c:if test="${not empty sku.product.minOrderQuantity}">
								<c:set var="minOrderQuantity" value="${product.minOrderQuantity}"/>
							</c:if>
							<input type="hidden" id="productSkuCode_${sku.productSkuId}" value="${sku.productSkuCode}"/>	
							<input type="hidden" id="productSkuName_${sku.productSkuId}" value="${sku.productSkuName}"/>
							<input type="hidden" id="imageUrl_${sku.productSkuId}" value="${sku.imageUrl}"/>	
							<input type="hidden" id="productId_${sku.productSkuId}" value="${sku.product.productId}"/>	
							<input type="hidden" id="productName_${sku.productSkuId}" value="${sku.product.productName}"/>	
							<input type="hidden" id="productCode_${sku.productSkuId}" value="${sku.product.productCode}"/>	
							<input type="hidden" id="minOrderQuantity_${sku.productSkuId}" value="${minOrderQuantity}"/>
							<input type="hidden" id="orderSkuDisplayOption_${sku.productSkuId}" value="${sku.orderSkuDisplayOption}"/>
							<input type="hidden" id="productImageUrl_${sku.productSkuId}" value="${sku.product.imageUrl}"/>	
							<input type="hidden" id="productKind_${sku.productSkuId}" value="${sku.product.productKind}"/>	
							
							<table>
								<tr>
									<td>
										&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" onclick='selectProductSku(${sku.productSkuId})'><product:productSkuImage productSku="${sku}" linkType="0" sizeType="s0"/></a>
										<br/><a href="javascript:void(0)" onclick='selectProductSku(${sku.productSkuId})'><b class="productCode">${sku.productSkuCode}</b></a>
									</td>
									<td style="width:150px;">
										<dl class="property_02 clearfix">
											<dd>
												<ul class="clearfix">
													<c:forEach items="${sku.productSkuOptionValues}" var="productSkuOptionValue">
														<product:skuOptionValue skuOptionValue="${productSkuOptionValue.skuOptionValue}"/>
													</c:forEach>
												</ul>
											</dd>	
										</dl>
									</td>
									<td>
										<product:productPrice productSku="${sku}" multiple="true" hasPriceName="true"/>
									</td>
								</tr>
							</table>
						</c:forEach>
					</c:when>
					<c:otherwise>
							<c:set var="sku" value="${product.defaultProductSku}"/>
							<c:set var="minOrderQuantity" value="1"/>
							<c:if test="${not empty sku.product.minOrderQuantity}">
								<c:set var="minOrderQuantity" value="${product.minOrderQuantity}"/>
							</c:if>
							<input type="hidden" id="productSkuCode_${sku.productSkuId}" value="${sku.productSkuCode}"/>	
							<input type="hidden" id="productSkuName_${sku.productSkuId}" value="${sku.productSkuName}"/>
							<input type="hidden" id="imageUrl_${sku.productSkuId}" value="${sku.imageUrl}"/>	
							<input type="hidden" id="productId_${sku.productSkuId}" value="${sku.product.productId}"/>	
							<input type="hidden" id="productName_${sku.productSkuId}" value="${sku.product.productName}"/>	
							<input type="hidden" id="productCode_${sku.productSkuId}" value="${sku.product.productCode}"/>	
							<input type="hidden" id="minOrderQuantity_${sku.productSkuId}" value="${minOrderQuantity}"/>
							<input type="hidden" id="orderSkuDisplayOption_${sku.productSkuId}" value="${sku.orderSkuDisplayOption}"/>
							<input type="hidden" id="productImageUrl_${sku.productSkuId}" value="${sku.product.imageUrl}"/>
							<input type="hidden" id="productKind_${sku.productSkuId}" value="${sku.product.productKind}"/>	
							
							<table>
								<tr>
									<td>
										&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" onclick='selectProductSku(${sku.productSkuId})'><product:productImage product="${product}" sizeType="s0" linkType="0"/></a>
										<br/><a href="javascript:void(0)" onclick='selectProductSku(${sku.productSkuId})'><b class="productCode">${sku.productSkuCode}</b></a>
									</td>
									<td style="width:150px;">
									</td>
									<td>
										<product:productPrice productSku="${product.defaultProductSku}" multiple="true" hasPriceName="true"/>
									</td>
								</tr>
							</table>
					</c:otherwise>
				</c:choose>	
			</div>	
		</display:column>
		<display:column style="width: 10%;" sortable="false" headerClass="data-table-title" decorator="com.probiz.estore.core.decorator.TblColumnDecorator" titleKey="product.category">
			${product.category.categoryName}
		</display:column>
		<display:column style="width: 10%;" sortable="false" headerClass="data-table-title" decorator="com.probiz.estore.core.decorator.TblColumnDecorator" titleKey="product.status">
			<fmt:message key="product.status.${product.status}"/>
		</display:column>
	</display:table>
</div>
<%@include file="/common/pagingOnly.jsp"%>

<%--------保存查询条件 -------%>
<%@include file="include/productSearchCriteriaStorage.jspf"%>


<script type="text/javascript">
highlightTableRows("product");

<c:if test="${sc.totalCount != 0 and (not empty productSearchCriteria.productSkuCode)}">	
	//stat:高亮搜索结果
	if("${productSearchCriteria.productSkuCode}".trim() != ""){
		 var searchValues = "${productSearchCriteria.productSkuCode}".trim();
		 $j('.productCode').each(function(){
			 highlight(this,searchValues); 
		 });
	} 
	//end:高亮搜索结果 
</c:if>	

$j("#product").chromatable({
    width: "100%",
    height: "510px",
    scrolling: "yes"
    
}); 
</script>

